// Copyright (c) 2011 The Kiwii Authors. All rights reserved.
// Use of this source code is governed by the New BSD License that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.

#ifndef KIWII_SERVER_INCLUDED
#define KIWII_SERVER_INCLUDED

#include <memory>

namespace kiwii {

  class KServerImpl;
  class KClient;
  
  class KServer {
  public:
    virtual ~KServer();

    // only one single KServer in the system
    static KServer& instance() { return instance_; }
    virtual void init(unsigned short port, char const* address = nullptr);

  protected:
    KServer();

  private:
    // noncopyable
    KServer(KServer const&) = delete;
    KServer& operator=(KServer const&) = delete;

    static KServer instance_;

    std::unique_ptr<KServerImpl> impl_;
  };

}

#endif
